home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0011_FAST-DEL.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  861b  |  21 lines

  1. { DR> DEL/ERASE command is able to erase an entire directory by using DEL *.*
  2.  DR> With such speed.  It clearly has a method other than deleting File by
  3.  DR> File.
  4.  
  5.   Function $41 of Int $21 will do what you want.  You'll need to
  6. make an ASCIIZ Filename of the path and File(s), and set a Pointer
  7. to it in DS:DX.  When it returns, if the carry flag (CF) is set,
  8. then AX holds the Dos error code.
  9. }
  10. Function DosDelete (FileName : PathStr) : Word; {returns error if any}
  11. Var Regs : Registers;
  12. begin
  13.   FileName[65] := 0;             {make asciiz- maybe, not sure}
  14.   Regs.DS := Seg(FileName);      {segment to String}
  15.   Regs.DX := offset(FileName)+1; {add one since f[0] is length}
  16.   Regs.AH := $41;
  17.   Regs.AL := 0;                  {Initialize}
  18.   Intr ($21, Regs);
  19.   if Regs.AL <> 0 {error} then DosDelete := Regs.AX else DosDelete := 0;
  20. end;
  21.